home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1432.dms / var1432.adf / NDUK-V40.lha / V40 / include / rexx / storage.i < prev   
Text File  |  1993-10-15  |  10KB  |  241 lines

  1.      IFND REXX_STORAGE_I
  2. REXX_STORAGE_I SET    1
  3. **
  4. **    $VER: storage.i 1.8 (8.11.91)
  5. **    Includes Release 40.15
  6. **
  7. **    Include file for REXX data structures and memory/storage management.
  8. **
  9. **    (C) Copyright 1986,1987,1988,1989,1990 William S. Hawes.
  10. **    (C) Copyright 1990-1993 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. **
  13.  
  14.      IFND EXEC_TYPES_I
  15.      INCLUDE "exec/types.i"
  16.      ENDC
  17.  
  18.      IFND EXEC_NODES_I
  19.      INCLUDE "exec/nodes.i"
  20.      ENDC
  21.  
  22.      IFND EXEC_LISTS_I
  23.      INCLUDE "exec/lists.i"
  24.      ENDC
  25.  
  26.      IFND EXEC_PORTS_I
  27.      INCLUDE "exec/ports.i"
  28.      ENDC
  29.  
  30.      IFND EXEC_LIBRARIES_I
  31.      INCLUDE "exec/libraries.i"
  32.      ENDC
  33.  
  34. * The NexxStr structure is used to maintain the internal strings in REXX.
  35. * It includes the buffer area for the string and associated attributes.
  36. * This is actually a variable-length structure; it is allocated for a
  37. * specific length string, and the length is never modified thereafter
  38. * (since it's used for recycling).
  39.  
  40.          STRUCTURE NexxStr,0
  41.          LONG     ns_Ivalue            ; integer value
  42.          UWORD    ns_Length            ; length in bytes (excl null byte)
  43.          UBYTE    ns_Flags             ; attribute flags
  44.          UBYTE    ns_Hash              ; sum-of-characters hash code
  45.          STRUCT   ns_Buff,8            ; buffer area for strings
  46.          LABEL    NSMINSIZE            ; 16 bytes (minimum)
  47.  
  48. NXADDLEN EQU      ns_Buff+1            ; structure offset plus null byte
  49. IVALUE   EQU      ns_Ivalue            ; integer value
  50.  
  51. * String attribute flag bit definitions
  52. NSB_KEEP    EQU   0                    ; permanent string? (in Symbol Table)
  53. NSB_STRING  EQU   1                    ; string form valid?
  54. NSB_NOTNUM  EQU   2                    ; non-numeric?
  55. NSB_NUMBER  EQU   3                    ; a valid number?
  56. NSB_BINARY  EQU   4                    ; integer value saved?
  57. NSB_FLOAT   EQU   5                    ; floating point format?
  58. NSB_EXT     EQU   6                    ; an external string?
  59. NSB_SOURCE  EQU   7                    ; part of the program source?
  60.  
  61. * The flag form of the string attributes
  62. NSF_KEEP    EQU   1<<NSB_KEEP
  63. NSF_STRING  EQU   1<<NSB_STRING
  64. NSF_NOTNUM  EQU   1<<NSB_NOTNUM
  65. NSF_NUMBER  EQU   1<<NSB_NUMBER
  66. NSF_BINARY  EQU   1<<NSB_BINARY
  67. NSF_FLOAT   EQU   1<<NSB_FLOAT
  68. NSF_EXT     EQU   1<<NSB_EXT
  69. NSF_SOURCE  EQU   1<<NSB_SOURCE
  70.  
  71. * Combinations of flags
  72. NSF_INTNUM  EQU   (NSF_NUMBER!NSF_BINARY!NSF_STRING)
  73. NSF_DPNUM   EQU   (NSF_NUMBER!NSF_FLOAT)
  74. NSF_ALPHA   EQU   (NSF_NOTNUM!NSF_STRING)
  75. NSF_OWNED   EQU   (NSF_SOURCE!NSF_EXT!NSF_KEEP)
  76. KEEPSTR     EQU   (NSF_STRING!NSF_SOURCE!NSF_NOTNUM)
  77. KEEPNUM     EQU   (NSF_STRING!NSF_SOURCE!NSF_NUMBER!NSF_BINARY)
  78.  
  79. * The RexxArg structure is identical to the NexxStr structure, but
  80. * is allocated from system memory rather than from internal storage.
  81. * This structure is used for passing arguments to external programs.
  82. * It is usually passed as an "argstring", a pointer to the string buffer.
  83.  
  84.          STRUCTURE RexxArg,0
  85.          LONG     ra_Size              ; total allocated length
  86.          UWORD    ra_Length            ; length of string
  87.          UBYTE    ra_Flags             ; attribute flags
  88.          UBYTE    ra_Hash              ; hash code
  89.          STRUCT   ra_Buff,8            ; buffer area
  90.          LABEL    RexxArg_SIZEOF       ; size: 16 bytes
  91. ; Changed to RexxArg_SIZEOF from ra_SIZEOF
  92.  
  93. * The RexxMsg structure is used for all communications with Rexx programs.
  94. * It is an EXEC message with a parameter block appended.
  95.  
  96.          STRUCTURE RexxMsg,MN_SIZE
  97.          APTR     rm_TaskBlock         ; pointer to RexxTask structure
  98.          APTR     rm_LibBase           ; library pointer
  99.          LONG     rm_Action            ; command (action) code
  100.          LONG     rm_Result1           ; return code
  101.          LONG     rm_Result2           ; secondary result
  102.          STRUCT   rm_Args,16*4         ; argument block (ARG0-ARG15)
  103.          APTR     rm_PassPort          ; forwarding port
  104.          APTR     rm_CommAddr          ; host address (port name)
  105.          APTR     rm_FileExt           ; file extension
  106.          LONG     rm_Stdin             ; input stream
  107.          LONG     rm_Stdout            ; output stream
  108.          LONG     rm_avail             ; future expansion
  109.          LABEL    RMSIZEOF             ; size: 128 bytes
  110. ; Ranamed from rm_SIZEOF
  111.  
  112. * Field definitions
  113. ACTION   EQU      rm_Action            ; action code
  114. RESULT1  EQU      rm_Result1           ; primary return/error level
  115. RESULT2  EQU      rm_Result2           ; secondary return/result string
  116. ARG0     EQU      rm_Args              ; start of argblock
  117. ARG1     EQU      rm_Args+4            ; first argument
  118. ARG2     EQU      rm_Args+8            ; second argument
  119.  
  120. MAXRMARG EQU      15                   ; maximum arguments
  121.  
  122. * Command (action) codes for message packets
  123. RXCOMM   EQU      $01000000            ; a command-level invocation
  124. RXFUNC   EQU      $02000000            ; a function call
  125. RXCLOSE  EQU      $03000000            ; close the port
  126. RXQUERY  EQU      $04000000            ; query for information
  127. RXADDFH  EQU      $07000000            ; add a function host
  128. RXADDLIB EQU      $08000000            ; add a function library
  129. RXREMLIB EQU      $09000000            ; remove a function library
  130. RXADDCON EQU      $0A000000            ; add/update a ClipList string
  131. RXREMCON EQU      $0B000000            ; remove a ClipList string
  132. RXTCOPN  EQU      $0C000000            ; open the trace console
  133. RXTCCLS  EQU      $0D000000            ; close the trace console
  134.  
  135. * Command modifier flag bits
  136. RXFB_NOIO   EQU   16                   ; suppress I/O inheritance?
  137. RXFB_RESULT EQU   17                   ; result string expected?
  138. RXFB_STRING EQU   18                   ; program is a "string file"?
  139. RXFB_TOKEN  EQU   19                   ; tokenize the command line?
  140. RXFB_NONRET EQU   20                   ; a "no-return" message?
  141.  
  142. * Modifier flags
  143. RXFF_RESULT EQU   1<<RXFB_RESULT
  144. RXFF_STRING EQU   1<<RXFB_STRING
  145. RXFF_TOKEN  EQU   1<<RXFB_TOKEN
  146. RXFF_NONRET EQU   1<<RXFB_NONRET
  147.  
  148. RXCODEMASK  EQU   $FF000000
  149. RXARGMASK   EQU   $0000000F
  150.  
  151. * The RexxRsrc structure is used to manage global resources.
  152. * The name string for each node is created as a RexxArg structure,
  153. * and the total size of the node is saved in the "rr_Size" field.
  154. * Functions are provided to allocate and release resource nodes.
  155. * If special deletion operations are required, an offset and base can
  156. * be provided in "rr_Func" and "rr_Base", respectively.  This function
  157. * will be called with the base in register A6 and the node in A0.
  158.  
  159.          STRUCTURE RexxRsrc,LN_SIZE
  160.          WORD     rr_Func              ; "auto-delete" offset
  161.          APTR     rr_Base              ; "auto-delete" base
  162.          LONG     rr_Size              ; total size of node
  163.          LONG     rr_Arg1              ; available ...
  164.          LONG     rr_Arg2              ; available ...
  165.          LABEL    RRSIZEOF             ; size: 32 bytes
  166. ; Changed from rr_SIZEOF to RRSIZEOF
  167.  
  168. * Field definitions
  169. RRTYPE   EQU      LN_TYPE              ; node type
  170. RRNAME   EQU      LN_NAME              ; node name (argstring)
  171. RRSIZE   EQU      rr_Size              ; total size of node
  172.  
  173. * Resource node types
  174. RRT_ANY  EQU      0                    ; any node type ...
  175. RRT_LIB  EQU      1                    ; a function library
  176. RRT_PORT EQU      2                    ; a public port
  177. RRT_FILE EQU      3                    ; a file IoBuff
  178. RRT_HOST EQU      4                    ; a function host
  179. RRT_CLIP EQU      5                    ; a Clip List node
  180.  
  181. * The RexxTask structure holds the fields used by REXX to communicate with
  182. * external processes, including the client task.  It includes the global
  183. * data structure (and the base environment).  The structure is passed to
  184. * the newly-created task in its "wake-up" message.
  185.  
  186. GLOBALSZ EQU      200                  ; space for the Global Data structure
  187.  
  188.          STRUCTURE RexxTask,GLOBALSZ   ; global data structure
  189.          STRUCT   rt_MsgPort,MP_SIZE   ; message port
  190.          UBYTE    rt_Flags             ; task flag bits
  191.          BYTE     rt_SigBit            ; signal bit
  192.  
  193.          APTR     rt_ClientID          ; the client's task ID
  194.      APTR      rt_MsgPkt           ; the packet being processed
  195.      APTR      rt_TaskID           ; our task ID
  196.      APTR      rt_RexxPort           ; the REXX public port
  197.  
  198.      APTR      rt_ErrTrap           ; Error trap address
  199.      APTR      rt_StackPtr           ; stack pointer for traps
  200.  
  201.      STRUCT   rt_Header1,LH_SIZE
  202.      STRUCT   rt_Header2,LH_SIZE
  203.      STRUCT   rt_Header3,LH_SIZE
  204.      STRUCT   rt_Header4,LH_SIZE
  205.      STRUCT   rt_Header5,LH_SIZE
  206.      LABEL      rt_SIZEOF
  207.  
  208. ENVLIST  EQU      rt_Header1           ; environment list (internal)
  209. FREELIST EQU      rt_Header2           ; freelist (internal)
  210. MEMLIST  EQU      rt_Header3           ; allocation list (external)
  211. FILELIST EQU      rt_Header4           ; I/O files list (external)
  212. PORTLIST EQU      rt_Header5           ; message ports list (external)
  213. NUMLISTS EQU      5
  214.  
  215. * Definitions for RexxTask flag bits
  216. RTFB_TRACE  EQU      0               ; external trace flag
  217. RTFB_HALT   EQU      1               ; external halt flag
  218. RTFB_SUSP   EQU      2               ; suspend task?
  219. RTFB_TCUSE  EQU      3               ; trace console in use?
  220. RTFB_WAIT   EQU      6               ; waiting for reply?
  221. RTFB_CLOSE  EQU      7               ; task completed?
  222.  
  223. * Definitions for memory allocation constants
  224. MEMQUANT EQU      16               ; quantum of memory space
  225. MEMMASK  EQU      $FFFFFFF0           ; mask for rounding the size
  226.  
  227. MEMQUICK EQU      (1<<0)           ; EXEC flags: MEMF_PUBLIC
  228. MEMCLEAR EQU      (1<<16)           ; EXEC flags: MEMF_CLEAR
  229.  
  230. * The SrcNode is a temporary structure used to hold values destined for a
  231. * segment array.  It is also used to maintain the memory freelist.
  232.  
  233.      STRUCTURE SrcNode,0           ; temporary source data structure
  234.      APTR      sn_Succ
  235.      APTR      sn_Pred
  236.      APTR      sn_Ptr           ; pointer value
  237.      LONG      sn_Size           ; size of object
  238.      LABEL      sn_SIZEOF           ; size: 16 bytes
  239.  
  240.      ENDC
  241.